///*
// *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
// *
// *  Redistribution and use in source and binary forms, with or without
// *  modification, are permitted provided that the following conditions are met:
// *
// *  Redistributions of source code must retain the above copyright notice,
// *  this list of conditions and the following disclaimer.
// *  Redistributions in binary form must reproduce the above copyright
// *  notice, this list of conditions and the following disclaimer in the
// *  documentation and/or other materials provided with the distribution.
// *  Neither the name of the dreamlu.net developer nor the names of its
// *  contributors may be used to endorse or promote products derived from
// *  this software without specific prior written permission.
// *  Author: Chill 庄骞 (smallchill@163.com)
// */
//package com.plian.system.controller.dp;
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.plian.Tools.FileTools;
//import com.plian.Tools.Func;
//import com.plian.Tools.StringPool;
//import com.plian.Tools.base.BaseController;
//import com.plian.Tools.pagedata.PageData;
//import com.plian.system.config.Resubmit;
//import com.plian.system.entity.dp.LeadingAccountable;
//import com.plian.system.model.CommonCode;
//import com.plian.system.model.ListResult;
//import com.plian.system.model.R;
//import com.plian.system.model.token.PassToken;
//import com.plian.system.mybatis.search.SearchEntity;
//import com.plian.system.mybatis.search.SearchParamEntiy;
//import com.plian.system.mybatis.search.TokenSearch;
//import com.plian.system.mybatis.support.Condition;
//import com.plian.system.mybatis.support.Query;
//import com.plian.system.service.dp.ILeadingAccountableService;
//import com.plian.system.service.wf.FormWorkflowService;
//import com.plian.system.vo.dp.LeadingAccountableVO;
//import com.plian.system.wrapper.dp.LeadingAccountableWrapper;
//import lombok.AllArgsConstructor;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.core.io.FileSystemResource;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.*;
//
//import javax.validation.Valid;
//import java.util.HashMap;
//import java.util.List;
//
///**
// * 领导干部问责情况 控制器
// *
// * @author jianglei
// * @since 2019-12-04
// */
//@RestController
//@AllArgsConstructor
//@RequestMapping("api/leadingaccountable")
//public class LeadingAccountableController extends BaseController {
//
//	private ILeadingAccountableService leadingAccountableService;
//
//	private FormWorkflowService formWorkflowService;
//
//	private LeadingAccountableWrapper leadingAccountableWrapper;
//
//
//	/**
//	 * 详情
//	 */
//	@PostMapping("/detail")
//	public R<LeadingAccountableVO> detail(@RequestBody LeadingAccountable leadingAccountable) {
//		LeadingAccountable detail = leadingAccountableService.getOne(Condition.getQueryWrapper(leadingAccountable));
//		LeadingAccountableVO leadingAccountableVO = leadingAccountableWrapper.entityToVO(detail);
//		R objResult = new R<LeadingAccountableVO>(CommonCode.SUCCESS);
//		objResult.setPageData(leadingAccountableVO);
//		return objResult;
//	}
//
//	/**
//	 * 分页 领导干部问责情况
//	 */
//	@PostMapping("/list")
//	public ListResult<LeadingAccountableVO> list(@RequestBody Query query) {
//		List<SearchEntity> entityList = query.getSearch();
//		if (query.getAscs()==null&&query.getDescs()==null){
//			query.setDescs("create_time");
//		}
//		QueryWrapper<LeadingAccountable> queryWrapper = SearchParamEntiy.getQueryWrapper(
//				Condition.getQueryWrapper(new LeadingAccountable()), entityList
//		);
//		TokenSearch<LeadingAccountable> tokenSearch = new TokenSearch<>();
//		tokenSearch.addTokenQuery(queryWrapper, query);
//
//		IPage<LeadingAccountable> pages = leadingAccountableService.page(Condition.getPage(query), queryWrapper);
//		ListResult<LeadingAccountableVO> listResult = new ListResult<>(CommonCode.SUCCESS);
//		listResult.setList(leadingAccountableWrapper.entityToVO(pages.getRecords()));
//		listResult.setTotal(Long.valueOf(pages.getTotal()).intValue());
//		return listResult;
//	}
//
//
//	/**
//	 * 新增或修改 领导干部问责情况
//	 */
//	@PostMapping("/submit")
//	@Resubmit(delaySeconds = 0)
//	public R submit(@Valid @RequestBody LeadingAccountable leadingAccountable) {
//		boolean result = leadingAccountableService.saveOrUpdate(leadingAccountable);
//		HashMap<String, Object> processVariable = new HashMap<>();
//		formWorkflowService.startProcessAndSimulate(String.valueOf(leadingAccountable.getId()),leadingAccountable.getFormType(),processVariable);
//
//		return result ? new R(CommonCode.SUCCESS) : new R(CommonCode.FAIL);
//	}
//
//	/**
//	 * 删除 领导干部问责情况
//	 */
//	@PostMapping("/remove")
//	public R remove(@RequestBody PageData pd) {
//		List<String> ids = (List<String>)pd.get("ids");
//		return leadingAccountableService.deleteLogic(Func.toLongList(StringUtils.join(ids, StringPool.COMMA)))
//				? new R(CommonCode.SUCCESS) : new R(CommonCode.FAIL);
//	}
//
//
//	/**
//	 * 打印
//	 */
//	@GetMapping("/buildpdf/{id}")
//	@PassToken
//	public ResponseEntity<FileSystemResource> buildPdf(@PathVariable Long id) {
//		return FileTools.exportPdf(leadingAccountableService.buildPdf(id));
//	}
//
//}
